<template>
  <div class="dropdowndiv">
    <el-row class="eldiv1">
      <el-col :span="24">
        <div class="prepend-dropdown">{{tableSetJson.label}}</div>
        <el-select
          v-model="mulrenum.rnuRadioContent"
          value-key="mulrenum.rnuRadioContent"
          @change="getSelectValue()"
        >
          <el-option label="优良" value="优良">优良</el-option>
          <el-option label="合格" value="合格">合格</el-option>
        </el-select>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  name: "dropdown",
  props: {
    /* 父组件传过来的数据 */
    tableSetJson: {
      type: Object
    },
    renumin: {
      type: Object
    }
  },
  watch: {
    mulrenum:{
      handler(newVal, oldVal) {
        this.$emit("listenToDateInput", newVal);
      }
    }
  },
  data() {
    return {
      mulrenum: this.renumin
    };
  },
  activated() {
    //console.log("============>>>>>>" + JSON.stringify(this.mulrenum));
  },
  methods: {
    /* 往父节点传值的方法 */
    getSelectValue() {
      this.mulrenum.rnuCode = this.tableSetJson.name;
      this.mulrenum.rnuType = this.tableSetJson.type;   
      this.mulrenum.rnuNo = this.tableSetJson.orderno;
      //console.log("============>>>>>>" + JSON.stringify(this.tableSetJson));
      /* 子组件主动发送数据给父组件 */
      //console.log("select组件输出对象：======>>>>>" + JSON.stringify(this.mulrenum));
      this.$emit("listenToSelectInput", this.mulrenum);
    },
    setPlaceholder() {
      return this.tableSetJson.texttip;
    }
  }
};
</script>
<style>
.prepend-dropdown {
  background-color: #f5f7fa;
  color: #909399;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  padding: 0 20px;
  white-space: nowrap;
  text-align: center;
  height: 30px;
  line-height: 30px;
  float: left;
  font-size: 13px;
  border-right: 0;
}
.dropdowndiv {
  width: 724px;
  margin-left: 5px;
  margin-top: 5px;
  margin-bottom: 5px;
  background-color: #f3f3f3;
}
</style>


